// 国际化
import { createI18n } from "vue-i18n";
import storage from "@/utils/storage";
import constant from "@/utils/constant";

import messages from "./modules/index"

export const getLanguage = () => {
  uni.setLocale('en');
  const language = storage.get(constant.language) || uni.getLocale() || "zh-Hans";
  return language;
};

const i18n = createI18n({
  locale: getLanguage(), // 设置默认语言
  messages,
  legacy: false,
  globalInjection: true, // 全局注册$t方法
  
});

export default i18n;
